package agent

import (
	"context"

	"gitee.com/liuxuezhan/ar-platform/rpc-client/agentClient/rpc"

	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type DeleteUserRebatesLevelLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

// 会员返佣等级--删除
func NewDeleteUserRebatesLevelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteUserRebatesLevelLogic {
	return &DeleteUserRebatesLevelLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *DeleteUserRebatesLevelLogic) DeleteUserRebatesLevel(req *types.UserRebatesLevelDeleteReq) (resp *types.IsSuccessInfo, err error) {

	report, err := l.svcCtx.AgentRPC.DeleteUserRebatesLevel(l.ctx, &rpc.DeleteUserRebatesLevelReq{
		IDList: req.IdList,
	})
	if err != nil {
		logx.Error(l.ctx, err)
		return nil, err
	}

	resp = &types.IsSuccessInfo{
		IsSuccess: report.IsSuccess,
	}
	return
}
